---
description: Learn the options available to configure your TriplitClient.
---

import { Callout } from 'nextra/components';

# Client configuration

## DB options

These options define your local cache.

- `schema` is a hard coded schema for your local cache
- `storage` determines the storage engines for your local cache (see [Storage](/client/storage))

## Sync options

These options define how you want to sync with the server.

- `serverUrl` is the url of the server where your project lives e.g. `https://<project-id>.triplit.io`
- `autoConnect` determines whether the client should connect to the server immediately upon instantiation. If set to `false`, you can manually connect with the `client.connect()` method.

<Callout type="warning" emoji="⚠️">
  The client connects over
  [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API),
  so you if you are instantiating a client in code that may run in an
  environment where WebSockets are not available (e.g. the server during
  server-side rendering), you should set `autoConnect` to `false` or preferably
  to an [environmental
  variable](https://kit.svelte.dev/docs/modules#$app-environment-browser) that
  indicates whether the client should connect.
</Callout>

The `serverUrl` can be updated with the `client.updateServerUrl` method.

## Auth options

These options define how you authenticate with your client database and remote database.

- `token` is a jwt that is used to identify the user to the client database and remote databases (see the [Auth guide](/auth)).
- `claimsPath` is the path to the Triplit claims on the token. It should be a `.` separated string like `path.to.claims`. This should match the value set on your project in the Triplit Dashboard.
- `onSessionError` is a function that is called when the client receives an error from the server about the session, which will lead to the sync connection to being terminated. Read more about refreshing a session in the [Sessions guide](/auth/sessions).
- `refreshOptions` can be used to set the `refreshHandler` and `interval` for the client. Read more about refreshing a session in the [Sessions guide](/auth/sessions).

## Experimental options

These options are experimental and may change in the future. All keys fall under the `experimental` key.

- `onDatabaseInit` is a hook that runs after your client-side database has initialized and before any client operations are run and syncing begins. This hook provides a DB instance and an `event` which tells you information about the database startup state.
